package com.hzdesk.media.koreabatchmatvector.logic.view;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.hzdesk.media.koreabatchmatvector.R;
import com.hzdesk.media.koreabatchmatvector.logic.contract.BoundCloudServiceContract;
import com.hzdesk.media.koreabatchmatvector.logic.persenter.BoundCloudServicePersenter;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2018/7/9.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 * <p>
 * TODO: 2018/7/10                                                                               绑定云服务
 */

public class BoundCloudServiceActivity extends BaseActivity  implements BoundCloudServiceContract.IBoundCloudServiceView {

    @BindView(R.id.activity_boun_cloud_service_iv_back)
    ImageView activityBounCloudServiceIvBack;
    @BindView(R.id.activity_boun_cloud_service_iv_qr_code)
    ImageView activityBounCloudServiceIvQrCode;
    @BindView(R.id.activity_boun_cloud_service_ll_bg)
    LinearLayout activityBounCloudServiceLlBg;

    private BoundCloudServicePersenter mBoundCloudServicePersenter = new BoundCloudServicePersenter(this);
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_boun_cloud_service);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        mBoundCloudServicePersenter.initDate(this,activityBounCloudServiceIvQrCode);
        activityBounCloudServiceIvBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mBoundCloudServicePersenter.onclickedBack();
            }
        });
    }

    @Override
    public void toFinshPager() {
        finish();
    }

    @Override
    protected void onStart() {
        super.onStart();
        final SharedPreferences mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
        int selector = mSharedPreferences.getInt("item_skin",0); //todo 名称
        activityBounCloudServiceLlBg.setBackgroundResource(updateBg[selector]);
    }
}
